<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta http-equiv="Content-Style-Type" content="text/css">
  <title></title>
  <meta name="Generator" content="Cocoa HTML Writer">
  <meta name="CocoaVersion" content="824.42">
  <style type="text/css">
    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica}
    p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
    p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
    p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
    p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
    p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #007300}
    p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000}
    span.s1 {color: #0000bf}
    span.s2 {color: #bf0000}
    span.s3 {color: #000000}
    span.s4 {color: #007300}
    span.Apple-tab-span {white-space:pre}
  </style>
</head>
<body>
<p class="p1"><b>PV_NoiseSynthP<span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>return only bins that are unstable</b></p>
<p class="p1"><b>PV_PartialSynthP<span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>return only bins that are stable</b></p>
<p class="p2"><br></p>
<p class="p3"><b>PV_NoiseSynthP and PV_PartialSynthP base these decisions on whether or not phase data across numFrames is within a given threshold</b></p>
<p class="p4"><b></b><br></p>
<p class="p3"><b>PV_NoiseSynthP(buffer, threshold, numFrames, initflag)</b></p>
<p class="p3"><b>PV_PartialSynthP(buffer, threshold, numFrames, initflag)</b></p>
<p class="p4"><b></b><br></p>
<p class="p3"><b><span class="Apple-tab-span">	</span>buffer - the FFT buffer</b></p>
<p class="p3"><b><span class="Apple-tab-span">	</span>threshold - a phase value (in radians) with which to allow values to pass through or be zeroed out</b></p>
<p class="p3"><b><span class="Apple-tab-span">	</span>numFrames - the number of FFT frames needed to make the above decision</b></p>
<p class="p3"><b><span class="Apple-tab-span">	</span>initflag - if 0, all bins are zeroed out while the initial is calculated, if 1, all bins pass through.</b></p>
<p class="p4"><b></b><br></p>
<p class="p3"><b>Examples:</b></p>
<p class="p2"><br></p>
<p class="p5">{<span class="s1">SinOsc</span>.ar(440, 0, 0.5) + <span class="s1">PinkNoise</span>.ar(0.4)}.play; <span class="s2">// a sample sig</span></p>
<p class="p2"><br></p>
<p class="p6"><span class="s1">SynthDef</span><span class="s3">(</span>\partialsynth<span class="s3">, {</span><span class="s1">arg</span><span class="s3"> fftbuf;</span></p>
<p class="p5"><span class="Apple-tab-span">	</span><span class="s1">var</span> in, chain, out;</p>
<p class="p5"><span class="Apple-tab-span">	</span>in = <span class="s1">SinOsc</span>.ar(440, 0, 0.5) + <span class="s1">PinkNoise</span>.ar(0.4);</p>
<p class="p5"><span class="Apple-tab-span">	</span>chain = <span class="s1">FFT</span>(fftbuf, in);</p>
<p class="p7"><span class="s3"><span class="Apple-tab-span">	</span></span>// resynhtesize according to MouseX if 0, only sound with VERY stable changes of phase</p>
<p class="p7"><span class="s3"><span class="Apple-tab-span">	</span></span>// will be returned. If pi, everything will be returned (+ or - pi)</p>
<p class="p5"><span class="Apple-tab-span">	</span>chain = <span class="s1">PV_PartialSynthP</span>(chain, <span class="s1">MouseX</span>.kr(0, pi));</p>
<p class="p5"><span class="Apple-tab-span">	</span>out = <span class="s1">IFFT</span>(chain);</p>
<p class="p5"><span class="Apple-tab-span">	</span><span class="s1">Out</span>.ar(0, out.dup);<span class="Apple-converted-space"> </span></p>
<p class="p5"><span class="Apple-tab-span">	</span>}).load(s);</p>
<p class="p2"><br></p>
<p class="p5">s.boot;<span class="Apple-converted-space"> </span></p>
<p class="p2"><br></p>
<p class="p7">// the fft buf</p>
<p class="p5">s.sendMsg(<span class="s4">\b_alloc</span>, 0, 2048);</p>
<p class="p2"><br></p>
<p class="p7">// start the synth</p>
<p class="p5">s.sendMsg(<span class="s4">\s_new</span>, <span class="s4">\partialsynth</span>, z = s.nextNodeID, 0, 1, <span class="s4">\fftbuf</span>, 0);</p>
<p class="p7">// free it</p>
<p class="p5">s.sendMsg(<span class="s4">\n_free</span>, z);</p>
<p class="p5">s.sendMsg(<span class="s4">\b_free</span>, 0);</p>
<p class="p2"><br></p>
<p class="p2"><br></p>
<p class="p2"><br></p>
<p class="p5"><span class="s1">SynthDef</span>(<span class="s4">\noisesynth</span>, {<span class="s1">arg</span> fftbuf;</p>
<p class="p5"><span class="Apple-tab-span">	</span><span class="s1">var</span> in, chain, out;</p>
<p class="p5"><span class="Apple-tab-span">	</span>in = <span class="s1">SinOsc</span>.ar(440, 0, 0.5) + <span class="s1">PinkNoise</span>.ar(0.4);</p>
<p class="p5"><span class="Apple-tab-span">	</span>chain = <span class="s1">FFT</span>(fftbuf, in);</p>
<p class="p7"><span class="s3"><span class="Apple-tab-span">	</span></span>// resynhtesize according to MouseX if 0, every thing will be returned... as the value</p>
<p class="p7"><span class="s3"><span class="Apple-tab-span">	</span></span>// increases, bins with VERY stable change of phase are zeroed out, until everything is</p>
<p class="p7"><span class="s3"><span class="Apple-tab-span">	</span></span>// at +-pi</p>
<p class="p5"><span class="Apple-tab-span">	</span>chain = <span class="s1">PV_NoiseSynthP</span>(chain, <span class="s1">MouseX</span>.kr(0, pi));</p>
<p class="p5"><span class="Apple-tab-span">	</span>out = <span class="s1">IFFT</span>(chain);</p>
<p class="p5"><span class="Apple-tab-span">	</span><span class="s1">Out</span>.ar(0, out.dup);<span class="Apple-converted-space"> </span></p>
<p class="p5"><span class="Apple-tab-span">	</span>}).load(s);</p>
<p class="p2"><br></p>
<p class="p5">s.boot;</p>
<p class="p2"><br></p>
<p class="p7">// the fft buf</p>
<p class="p5">s.sendMsg(<span class="s4">\b_alloc</span>, 0, 2048);</p>
<p class="p2"><br></p>
<p class="p7">// start the synth</p>
<p class="p5">s.sendMsg(<span class="s4">\s_new</span>, <span class="s4">\noisesynth</span>, z = s.nextNodeID, 0, 1, <span class="s4">\fftbuf</span>, 0);</p>
<p class="p7">// free it</p>
<p class="p5">s.sendMsg(<span class="s4">\n_free</span>, z);</p>
<p class="p5">s.sendMsg(<span class="s4">\b_free</span>, 0);</p>
<p class="p2"><br></p>
<p class="p2"><br></p>
<p class="p5">s.quit</p>
<p class="p2"><br></p>
</body>
</html>
